# _*_ coding: utf-8 _*_
# .@FileName:follicle
# .@Data....:2025-06-02 : 23 : 36
# .@Aurhor..:LiuJingYu
"""
launch:
from __future__ import unicode_literals, print_function
import maya.cmds as mc
"""
from facialLesson.rigUtils import controllerUtils,utils,attrUtils
import maya.cmds as cmds

attach_geo = 'mesh_m_high_face_001'

ctrls_list = cmds.ls(sl=True)
for ctrl in ctrls_list:
    offset_grp = '{}_001'.format(ctrl.replace('ctrl_','grpOffset_'))
    if cmds.objExists(offset_grp):
        constraint_grp = controllerUtils.add_extra_group(obj=offset_grp,
                                                         grp_name=offset_grp.replace('grpOffset_','constraint_'),
                                                         world_orient=False)

        follicle = utils.create_follicle(grp_parent='DEFORM', geo=attach_geo,ctrl=ctrl)
        cmds.parentConstraint(follicle,constraint_grp,mo=True)

        inverse_grp = ctrl.replace('ctrl_', 'inverse_')

        controllerUtils.solve_double_transform(ctrl=ctrl, inverse_grp_name=inverse_grp)

        for grp in [constraint_grp, inverse_grp]:

            attrUtils.lock_and_hide_attrs(
            obj=constraint_grp,
            attrs_list=['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v'],
            lock=True,
            hide=False
            )



